<?php 
class ArcController{
	/**
	 * 异步提交
	 */
	 public function add(){
	 	$data = include './data.php';
		$data[] = $_POST;
		file_put_contents('./data.php', "<?php return ". var_export($data,true) ."?>");
		$id = max(array_keys($data));
		$_POST['id'] = $id;
		echo json_encode($_POST);
	 }
	 public function del(){
	 	$data = include './data.php';
//		P($_POST);die;
		$id = $_POST['u'];
		unset($data[$id]);
		file_put_contents('./data.php', "<?php return ". var_export($data,true) . "?>");
	 }
	 public function edit(){
	 	$data = include './data.php';
		$id =intval($_GET['id']);
		$old = $data[$id];
		if($_POST){
			$_POST['sendtime']=$old['sendtime'];
			$data[$id] = $_POST;
			file_put_contents('./data.php',"<?php return " . var_export($data,true) . " ?>");
            success('修改成功','index.php');
		}
		include './View/edit.html';
    }
}






 ?>